import React, { Component } from 'react'
//引入
import { withRouter } from 'react-router-dom'
class Header extends Component {
  back = () => {
    this.props.history.goBack()
  }
  render() {
    console.log(this.props)
    return (
      <div>
        React-Router-Dom
        <button onClick={this.back}>返回</button>
      </div>
    )
  }
}
//把普通组件转换成路由组件
export default withRouter(Header)
